package com.video.user.config;


import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectConfig {

    /*
    * 声明交换机
    * */
    public DirectExchange directExchange() {
        return ExchangeBuilder.directExchange("video.direct").build();
    }

    /*
    * 声明队列
    * */
    public Queue directQueue1(){
        return new Queue("direct.queue1");
    }

    public Queue directQueue2(){
        return new Queue("direct.queue2");
    }

    /*
    * 绑定队列
    * */
    public Binding bindingQueueWithRed(Queue directQueue1, DirectExchange directExchange){
        return BindingBuilder.bind(directQueue1).to(directExchange).with("red");
    }

    public Binding bindingQueueWithBlue(Queue directQueue2, DirectExchange directExchange){
        return BindingBuilder.bind(directQueue2).to(directExchange).with("blue");
    }

}
